The efficiency of the insert operation is determined by the height of the heap.
- Adding the element to the end of the array is a constant time operation, $O(1)$.
- The "bubble up" process travels up the tree from a leaf towards the root.
- The number of potential swaps is limited by the height of the tree.
- A complete binary tree with $n$ nodes has a height of $O(\log n)$.
Total Complexity
The total time complexity for insert is dominated by the bubble up process, resulting in an overall complexity of $O(\log n)$.
Nodes (n): 1
Height (h): 0
$\log_2(n)$: 0.00